import React from "react";
import { RouterRawState } from "../types";
import MainLayout from "../components/mainLayout";

const Detail = React.lazy(() => import("../views/detail"));
const Home = React.lazy(() => import("../views/home"));
const List = React.lazy(() => import("../views/list"));
const Login = React.lazy(() => import("../views/login"));
const My = React.lazy(() => import("../views/my"));
const Regist = React.lazy(() => import("../views/regist"));
const Search = React.lazy(() => import("../views/search"));
const Set = React.lazy(() => import("../views/set"));
const NotPromission= React.lazy(() => import("../views/403"));

export const Router_List: RouterRawState[] = [
  {
    path: "/",
    element: (
      <MainLayout>
        <Home></Home>
      </MainLayout>
    ),
    label: '首页'
  },
  {
    path: "/detail/:id",
    element: <Detail></Detail>,
    label: '详情',
    hidden: true
  },
  {
    path: "/list",
    element: (
      <MainLayout>
        <List></List>
      </MainLayout>
    ),
    label: '列表',
    roles: ['admin', 'teacher']
  },
  {
    path: "/login",
    element: <Login></Login>,
    label: '登录',
    hidden: true
  },
  {
    path: "/my",
    element: (
      <MainLayout>
        <My></My>
      </MainLayout>
    ),
    label: '我的'
  },
  {
    path: "/regist",
    element: <Regist></Regist>,
    label: '注册',
    hidden: true
  },
  {
    path: "/set",
    element: (
      <MainLayout>
        <Set></Set>
      </MainLayout>
    ),
    label: '设置',
    roles: ['admin']
  },
  {
    path: "/search",
    element: <Search></Search>,
    label: '搜索',
    hidden: true
  },
  {
    path: '/403',
    element: <MainLayout>
      <NotPromission></NotPromission>
    </MainLayout>,
    label: '403',
    hidden: true
  }
];
